﻿using System;
using DNT.RavenQA.Core.Extensions;
using Raven.Client;

namespace DNT.RavenQA.Web.Infrastructure.Extensions
{
    public static class SessionExtensions
    {
        public static String GetRealId<T>(this IDocumentSession session, Object id)
        {
            session.EnsureIsNotNull("session");

            return session.Advanced
                          .DocumentStore
                          .Conventions
                          .FindFullDocumentKeyFromNonStringIdentifier(id, typeof(T), false);
        }
    }
}